PowerShell 1: Before You Begin

2026-09-20 · powershell, class-notes

Graphical tools are good for doing one thing, once. They struggle with:

Class notes · Learn PowerShell in a Month of Lunches (Jeffery Hicks et al.) · Chapter 1

Quick reference: the short version of this chapter is the Chapter 1 cheat sheet.

Learning objectives

By the end of these notes you should be able to:

  1. Explain why administrators and security teams learn PowerShell rather than relying on graphical tools.
  2. Distinguish Windows PowerShell 5.1 from PowerShell 7, and identify which one you're running.
  3. Install PowerShell 7 on Windows, macOS or Linux, and verify the installation.
  4. Set up a safe practice lab.
  5. Plan a study routine that matches how the book is designed to be used.
  6. Explain why PowerShell matters to both attackers and defenders.

1. Why PowerShell?

1.1 The limits of the GUI

Graphical tools are good for doing one thing, once. They struggle with:

Task

GUI

PowerShell

Disable one account

A few clicks

One command

Disable 300 leavers from a spreadsheet

300 rounds of the same clicks — slow and error-prone

The same command, fed the list

Report which servers are missing an update

Log on to each one

One command run against all of them

Prove exactly what you changed

Screenshots, memory

The commands themselves are the record

Repeat the job next month

Do it all again

Run the same script

The core idea is automation: describe a task once, precisely, then repeat it at any scale.

1.2 Where PowerShell is used

In the real world: job adverts for help desk, sysadmin and SOC roles routinely list PowerShell. Being able to say "I automated this" — with a script to show — stands out.

2. Windows PowerShell vs PowerShell 7

There are two main lines of PowerShell, and you'll meet both.

Windows PowerShell 5.1

PowerShell 7.x

Comes with

Windows (built in)

Separate install

Built on

.NET Framework

Modern .NET (formerly .NET Core)

Runs on

Windows only

Windows, macOS, Linux

Executable

powershell.exe

pwsh (pwsh.exe on Windows)

Development

Maintenance only — security fixes, no new features

Actively developed

$PSVersionTable.PSEdition

Desktop

Core

Can they coexist?

Yes — installing 7 doesn't remove or replace 5.1

The book teaches PowerShell 7, because it's the version that's moving forward and works on every platform. Almost everything also applies to 5.1, and a few older Windows-only modules still need 5.1 — when that matters, the book says so.

2.1 Worked example — which version am I running?

PS> $PSVersionTable

Name Value


PSVersion 7.4.6 PSEdition Core GitCommitId 7.4.6 OS Ubuntu 24.04.4 LTS Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.01. PSVersion 7.4.6 — this is PowerShell 7. 2. PSEdition Core — confirms the modern, cross-platform line. Windows PowerShell shows Desktop and version 5.1.x. 3. OS and Platform — this session is on Linux (Unix). On Windows, Platform shows Win32NT.

Just the version number:

$PSVersionTable.PSVersion

Note: PowerShell 7 has LTS (long-term support) releases and shorter-lived current releases. For work systems, an LTS release is usually the safer choice. Check Microsoft's PowerShell support lifecycle page for current dates.

3. Setting up your lab

3.1 What you need

3.2 Installing PowerShell 7

OS

Recommended method

Windows

winget install --id Microsoft.PowerShell --source winget — or the MSI from the PowerShell GitHub releases page

macOS

brew install --cask powershell (Homebrew)

Ubuntu / Debian

Add Microsoft's package repository, then sudo apt-get install -y powershell — or sudo snap install powershell --classic

RHEL / Fedora

Add Microsoft's repository, then sudo dnf install -y powershell

Microsoft's "Install PowerShell" documentation has the exact repository steps for each distribution and version. Follow it rather than copying commands from random blogs.

3.3 Worked example — install and verify on Windows

  1. Open Windows Terminal or Command Prompt, and run:

winget install --id Microsoft.PowerShell --source winget1. Start PowerShell 7: type pwsh, or pick PowerShell (not "Windows PowerShell") in the Start menu or a new Windows Terminal tab. 2. Check the version:

$PSVersionTable.PSVersion $PSVersionTable.PSEdition \

should say Core1. Confirm 5.1 is still there: run powershell from inside pwsh, check $PSVersionTable.PSEdition says Desktop, then type exit to return.

3.4 Keeping it updated

Method

Update with

winget

winget upgrade --id Microsoft.PowerShell

Homebrew

brew upgrade --cask powershell

apt / dnf

Your normal system updates

4. How to use the book

4.1 The "month of lunches" design

The book is built around short daily sessions: one chapter a day, sized to fit a lunch break (roughly an hour including the lab). Its chapters follow a consistent pattern:

Element

What to do with it

Main text

Read it with a PowerShell window open

Try it now sections

Stop and type the commands yourself — straight away

Hands-on labs

Do them before moving on; answers are provided for checking

Above and beyond sections

Optional depth — skip on a busy day, return later

4.2 Study habits that work with this book

4.3 Worked example — a four-week plan

Week

Chapters

Weekend review

1

1–5: setup, help, running commands, providers

Redo the labs from memory

2

6–10: pipeline, modules, objects, formatting

Write cheat sheet entries

3

11–15: filtering, remoting, jobs, multitasking

Try one real task in the home lab

4

Remaining chapters

Automate one real, repetitive task end to end

Chapter groupings above are illustrative — adjust to the edition you're reading and to your own pace. Consistency matters more than speed.

5. Security perspective

Summary

Glossary

Term

Definition

PowerShell

Microsoft's command-line shell and scripting language

Automation

Performing tasks through repeatable commands rather than by hand

Windows PowerShell 5.1

The built-in, Windows-only version, based on .NET Framework

PowerShell 7

The modern, cross-platform version, based on .NET

powershell.exe / pwsh

The executables for Windows PowerShell / PowerShell 7

.NET

The software framework PowerShell is built on

PSEdition

Desktop (5.1) or Core (6 and later)

$PSVersionTable

A built-in variable describing the running PowerShell

Cross-platform

Running on Windows, macOS and Linux

LTS

Long-term support release

winget

The Windows package manager

Homebrew

A package manager for macOS

Module

A package of PowerShell commands for a product or task

Lab

A safe environment for practice

Living off the land

Attackers using legitimate built-in tools to avoid detection

Script block logging

Windows logging that records the PowerShell code that ran

Transcription

Recording a PowerShell session's input and output to a text file

Review questions

  1. Give two tasks where PowerShell clearly beats a GUI tool, and explain why.
  2. What are the executable names for Windows PowerShell and PowerShell 7?
  3. $PSVersionTable.PSEdition returns Desktop. Which PowerShell are you in?
  4. Does installing PowerShell 7 remove Windows PowerShell 5.1?
  5. On which operating systems does PowerShell 7 run?
  6. Write the winget command to install PowerShell 7.
  7. What does $PSVersionTable.Platform show on Linux, and on Windows?
  8. What are "Try it now" sections for, and how should you use them?
  9. Why does the book emphasise discovering commands over memorising them?
  10. What does "living off the land" mean, and why is PowerShell a good example?
  11. Name two kinds of PowerShell logging defenders can enable.
  12. Why was Windows PowerShell 2.0 attractive to attackers?

Answer key

  1. Any two, such as: changing hundreds of accounts from a list; reporting on many servers at once; repeating a monthly task. One command applies at any scale and is repeatable.
  2. powershell.exe and pwsh.
  3. Windows PowerShell (5.1).
  4. No — they install side by side.
  5. Windows, macOS and Linux.
  6. winget install --id Microsoft.PowerShell --source winget.
  7. Unix on Linux (and macOS); Win32NT on Windows.
  8. Hands-on moments within a chapter — stop and type the commands immediately, rather than reading on.
  9. There are thousands of commands; knowing how to find and learn them (mainly through help) matters more than recalling any one.
  10. Attackers using legitimate built-in tools so their activity blends in. PowerShell is on every Windows machine, is trusted and is very powerful.
  11. Any two of: script block logging, module logging, transcription.
  12. It lacked modern logging and security protections, so attacks run in it were harder to see.